<?php

init();

function init()
{
    global $dbsql,$language;
    
    if($_GET['act']=='reset')
    {
        $dbsql->query('drop table tbltripplanner',true);
    }
    
    $table = "CREATE TABLE `tbltripplanner` (
          `iId` int(6) NOT NULL AUTO_INCREMENT,
          `sex` varchar(6) DEFAULT NULL,
          `cName` varchar(50) NOT NULL,
          `cAddress` varchar(200) DEFAULT NULL,
          `email` varchar(50) DEFAULT NULL,
          `adults` int(2) DEFAULT NULL,
          `adults_ages` varchar(20) DEFAULT NULL,
          `country` varchar(30) DEFAULT NULL,
          `phone` varchar(15) DEFAULT NULL,
          `cFax` varchar(200) DEFAULT NULL,
          `children` int(1) DEFAULT NULL,
          `children_ages` varchar(20) DEFAULT NULL,
          `arrival_date` varchar(10) DEFAULT NULL,
          `departure_date` varchar(10) DEFAULT NULL,
          `arrival_port` varchar(20) DEFAULT NULL,
          `departure_port` varchar(20) DEFAULT NULL,
          `duration` varchar(10) DEFAULT NULL,
          `destinations` varchar(200) DEFAULT NULL,
          `activities` varchar(200) DEFAULT NULL,
          `transportation` varchar(100) DEFAULT NULL,
          `accommodation_food` varchar(200) DEFAULT NULL,
          `questions_comments` text,
          `findus` varchar(50) DEFAULT NULL,
          `dDate` date DEFAULT NULL,
          `iStatus` int(1) DEFAULT NULL,
          `cLanguage` varchar(10) DEFAULT NULL,
          PRIMARY KEY (`iId`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
            
            
    $tablehas = $dbsql->query("show tables like 'tbltripplanner';");
    if($dbsql->num_rows($tablehas)==0)
    {
        $dbsql->query($table,true);
    }    
}



function ListTripplanner()
{
    global $dbsql,$language;
    
    $sql_select = "select count(iId) as count from tbltripplanner";
    $result     = $dbsql->query_fetch($sql_select);
    $countall   = $result['count'];
    
    list($lf,$la)=Slit_Page($countall);
    $sql_select = "select * from tbltripplanner order by iId desc limit $lf,$la";
    return $dbsql->load($sql_select);    
}
?>